<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="java面试jvm八股文, 戴某的博客">
    <meta name="description" content="戴某的笔记">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>java面试jvm八股文 | 戴某的博客</title>
    <link rel="icon" type="image/png" href="/dai_modest/favicon.png">

    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/dai_modest/css/my.css">

    <script src="/dai_modest/libs/jquery/jquery.min.js"></script>

<meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/dai_modest/atom.xml" title="戴某的博客" type="application/atom+xml">
<link rel="stylesheet" href="/dai_modest/css/prism-tomorrow.css" type="text/css"></head>



   <style>
    body{
       background-image: url(https://cdn.jsdelivr.net/gh/Tokisaki-Galaxy/res/site/medias/background.jpg);
       background-repeat:no-repeat;
       background-size:cover;
       background-attachment:fixed;
    }
</style>



<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/dai_modest/" class="waves-effect waves-light">
                    
                    <img src="/dai_modest/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">戴某的博客</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/dai_modest/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/dai_modest/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">戴某的博客</div>
        <div class="logo-desc">
            
            戴某的笔记
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/dai_modest/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/blinkfox/hexo-theme-matery" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/blinkfox/hexo-theme-matery" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/dai_modest/medias/featureimages/3.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">java面试jvm八股文</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/dai_modest/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        padding: 35px 0 15px 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        padding-bottom: 30px;
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/dai_modest/tags/jvm/">
                                <span class="chip bg-color">jvm</span>
                            </a>
                        
                            <a href="/dai_modest/tags/java/">
                                <span class="chip bg-color">java</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/dai_modest/categories/%E7%AC%94%E8%AE%B0%E7%B1%BB/" class="post-category">
                                笔记类
                            </a>
                        
                            <a href="/dai_modest/categories/%E7%AC%94%E8%AE%B0%E7%B1%BB/%E9%9D%A2%E8%AF%95%E7%B1%BB/" class="post-category">
                                面试类
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2021-10-11
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2021-10-11
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    2.9k
                </div>
                

                

                
            </div>
        </div>
        <hr class="clearfix">

        
        <!-- 是否加载使用自带的 prismjs. -->
        <link rel="stylesheet" href="/dai_modest/libs/prism/prism.css">
        

        
        <!-- 代码块折行 -->
        <style type="text/css">
            code[class*="language-"], pre[class*="language-"] { white-space: pre-wrap !important; }
        </style>
        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="1-简述java垃圾回收机制"><a href="#1-简述java垃圾回收机制" class="headerlink" title="1.简述java垃圾回收机制"></a>1.简述java垃圾回收机制</h1><p>在java中，和c++那些不同<strong>不需要显示的去释放</strong>一个对象的内存，而是由<strong>虚拟机自动执行</strong>。在jvm中，有个垃圾回收的线程，他是<strong>低优先级的</strong>，在正常情况下不会触发执行，只有在虚拟机<strong>空闲或者当前堆内存不足</strong>时，才会触发执行。扫描那些没有被任何应用的对象，并将它们添加到回收的集合中进行回收（触发GC算法进行回收）。</p>
<h1 id="2-GC是什么？为什么要GC"><a href="#2-GC是什么？为什么要GC" class="headerlink" title="2.GC是什么？为什么要GC"></a>2.GC是什么？为什么要GC</h1><p>GC英文来讲就是（Gabage Collection）就是垃圾收集的意思。</p>
<p>java语言没有提供释放已分配内存的显示操作方法，回收会导致程序或系统的<strong>不稳定甚至崩溃</strong>，java提供的GC功能可以<strong>自动监测对象</strong>是否超过作用域从而达到<strong>自动回收</strong>的目的。</p>
<h1 id="3-垃圾回收的优点和原理。并考虑2种回收机制。"><a href="#3-垃圾回收的优点和原理。并考虑2种回收机制。" class="headerlink" title="3.垃圾回收的优点和原理。并考虑2种回收机制。"></a>3.垃圾回收的优点和原理。并考虑2种回收机制。</h1><p>java语言的显著特点就是有垃圾回收机制，使得java在编写程序时不再考虑内存管理问题。</p>
<p>1.有了垃圾回收机制，java中<strong>对象不再有“作用域”</strong>的概念，只有引用的对象才有“作用域”。</p>
<p>2.垃圾回收机制有效的防止了<strong>内存泄露</strong>，可以有效的使用可使用的内存。</p>
<p>3.垃圾回收器通常作为一个<strong>单独的低级别的线程运行</strong>，在空闲或者堆内存等等触发会情况下对堆中已经死亡的或者很长时间没有用过的对象进行清除和回收。</p>
<p>4.程序员不能实时的对某个对象或所有对象调用垃圾回收期进行垃圾回收。</p>
<p>垃圾回收有复制垃圾回收，标记-压缩垃圾回收、分代复制垃圾回收、增量收集。</p>
<h1 id="4-垃圾回收器的基本原理是什么？垃圾回收期可以马上回收内存吗？有什么方法主动通知虚拟机进行垃圾回收？"><a href="#4-垃圾回收器的基本原理是什么？垃圾回收期可以马上回收内存吗？有什么方法主动通知虚拟机进行垃圾回收？" class="headerlink" title="4.垃圾回收器的基本原理是什么？垃圾回收期可以马上回收内存吗？有什么方法主动通知虚拟机进行垃圾回收？"></a>4.垃圾回收器的基本原理是什么？垃圾回收期可以马上回收内存吗？有什么方法主动通知虚拟机进行垃圾回收？</h1><p>对于GC来说，当程序员创建对象时，GC就开始监控这个对象的地址、大小以及使用情况。通常，GC采用<strong>有向图的方式记录</strong>和管理堆中的所有对象，通过这种方式确定哪些对象时“可达的”，哪些对象是”不可达的“，当GC确定一些对象为不可达时，GC就会有责任回收这些内存空间。</p>
<p>可以。程序员可以手动执行System.gc（），通知GC运行，但是java语言规范并不保证GC一定会执行。（我可以通知，但不一定会执行）</p>
<h1 id="5-java中有哪些引用类型"><a href="#5-java中有哪些引用类型" class="headerlink" title="5.java中有哪些引用类型"></a>5.java中有哪些引用类型</h1><p>强引用：发生gc的时候不会被回收。</p>
<pre class=" language-java"><code class="language-java">Object obj <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Object</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment" spellcheck="true">//只要obj还指向Object对象，Object对象就不会被回收</span>
obj <span class="token operator">=</span> null<span class="token punctuation">;</span>  <span class="token comment" spellcheck="true">//手动置null</span>
</code></pre>
<p>软引用：有用但不是必须的对象，在发生内存溢出之前会被回收。</p>
<pre class=" language-java"><code class="language-java"><span class="token comment" spellcheck="true">//软引用是使用SoftReference创建的引用，强度弱于强引用，被其引用的对象在内存不足的时候会被回收，不会产生内存溢出。</span>
</code></pre>
<p>弱引用：有用但不是必须的对象，在下一次GC时会被回收。</p>
<p>虚引用：无法通过虚引用获得对象，用 PhantomReference 实现虚引用，虚引用的用途是在 <strong>gc 时返回一个通知</strong>。</p>
<h1 id="6-怎么判断对象是否可以被回收"><a href="#6-怎么判断对象是否可以被回收" class="headerlink" title="6.怎么判断对象是否可以被回收"></a>6.怎么判断对象是否可以被回收</h1><p>一般由两种方法来判断：</p>
<p>引用计数器：为每个对象创建一个引用计数，有对象引用时计数器+1，引用被释放时计数-1，当计数器为0时就可以回收了。缺点：不能解决循环引用问题。</p>
<p>可达性分析算法：从GC Roots开始向下搜索，搜索所走过的路径称为引用链。当一个对象到GC Roots没有任何引用链相连的时候就代表这个对象时可以回收的。</p>
<h1 id="7-在Java中，对象什么时候可以被垃圾回收？"><a href="#7-在Java中，对象什么时候可以被垃圾回收？" class="headerlink" title="7.在Java中，对象什么时候可以被垃圾回收？"></a>7.在Java中，对象什么时候可以被垃圾回收？</h1><p>当对象对当前使用的对象的应用程序变得不可触及的情况下，这个对象就可以被回收了。</p>
<h1 id="8-JVM中的永久代中会发生垃圾回收吗"><a href="#8-JVM中的永久代中会发生垃圾回收吗" class="headerlink" title="8.JVM中的永久代中会发生垃圾回收吗"></a>8.JVM中的永久代中会发生垃圾回收吗</h1><p>垃圾回收不会发生在永久代，如果永久代满了或者是超过了临界值，会触发完全垃圾回收(Full GC)。</p>
<h1 id="9-说一下-JVM-有哪些垃圾回收算法？"><a href="#9-说一下-JVM-有哪些垃圾回收算法？" class="headerlink" title="9.说一下 JVM 有哪些垃圾回收算法？"></a>9.说一下 JVM 有哪些垃圾回收算法？</h1><p>标记-清除算法：标记无用对象，然后进行清除回收。缺点：效率不高，无法清除垃圾碎片。</p>
<p>复制算法：按照容量划分二个大小相等的内存区域，当一块用完的时候将活着的对象复制到另一块上，然后再把已使用的内存空间一次清理掉。缺点：内存使用率不高，只有原来的一半。</p>
<p>标记-整理算法：标记无用对象，让所有存活的对象都向一端移动，然后直接清除掉端边界以外的内存。</p>
<p>分代算法：根据对象存活周期的不同将内存划分为几块，一般是新生代和老年代，新生代基本采用复制算法，老年代采用标记整理算法。</p>
<p>标记-清除算法：标记无用对象，然后进行清除回收。</p>
<h1 id="10-说一下-JVM-有哪些垃圾回收器？"><a href="#10-说一下-JVM-有哪些垃圾回收器？" class="headerlink" title="10.说一下 JVM 有哪些垃圾回收器？"></a>10.说一下 JVM 有哪些垃圾回收器？</h1><p>复制算法：</p>
<p>Serial收集器: 新生代单线程收集器，标记和清理都是单线程，优点是简单高效；</p>
<p>ParNew收集器 : 新生代收并行集器，在多核CPU环境下有着比Serial更好的表现；</p>
<p>Parallel Scavenge收集器： 新生代并行收集器，追求高吞吐量，高效利用 CPU。</p>
<p>标记清除算法：</p>
<p>CMS(Concurrent Mark Sweep)收集器：老年代并行收集器，具有高并发、低停顿的特点，追求最短GC回收停顿时间。</p>
<p>标记整理算法：</p>
<p>Serial Old收集器：老年代单线程收集器，Serial收集器的老年代版本。</p>
<p>Parallel Old收集器：老年代并行收集器，吞吐量优先，Parallel Scavenge收集器的老年代版本；</p>
<p>G1(Garbage First)收集器：G1回收的范围是整个Java堆。</p>
<h1 id="11-详细介绍一下-CMS-垃圾回收器？"><a href="#11-详细介绍一下-CMS-垃圾回收器？" class="headerlink" title="11.详细介绍一下 CMS 垃圾回收器？"></a>11.详细介绍一下 CMS 垃圾回收器？</h1><p>CMS 是英文 Concurrent Mark-Sweep 的简称，具有高并发、低停顿的特点，是以牺牲吞吐量为代价来获得最短回收停顿时间的垃圾回收器。</p>
<h1 id="12-新生代垃圾回收器和老年代垃圾回收器有什么区别？"><a href="#12-新生代垃圾回收器和老年代垃圾回收器有什么区别？" class="headerlink" title="12.新生代垃圾回收器和老年代垃圾回收器有什么区别？"></a>12.新生代垃圾回收器和老年代垃圾回收器有什么区别？</h1><p>新生代垃圾回收器一般采用的是复制算法，复制算法的优点是效率高，缺点是内存利用率低；老年代回收器一般采用的是标记-整理的算法进行垃圾回收。</p>
<h1 id="13-简述分代垃圾回收器是怎么工做的？"><a href="#13-简述分代垃圾回收器是怎么工做的？" class="headerlink" title="13.简述分代垃圾回收器是怎么工做的？"></a>13.简述分代垃圾回收器是怎么工做的？</h1><p>分代回收器有两个分区：老生代和新生代，新生代默认的空间占比总空间的 1/3，老生代的默认占比是 2/3。</p>
<p>新生代中分了3个区：Eden区，from区，to区。</p>
<p>新生代使用的是复制算法，把Eden，from存活的对象放入到to区中，清空from和Eden区，然后to区分区交换，from变成to，to变成from。每次移动交换时，存活的对象年龄就会+1，当年龄达到15（默认是15）就会升级为老年代。大对象也会直接进入老年代。</p>
<p>老年代当空间占用到某个值后会触发FULL GC（全局垃圾回收），一般使用标记整理的执行算法。 </p>
<h1 id="14-什么是jvm内存结构"><a href="#14-什么是jvm内存结构" class="headerlink" title="14.什么是jvm内存结构"></a>14.什么是jvm内存结构</h1><p>jvm将虚拟机分为5大区域，程序计数器、虚拟机栈(java栈)、本地方法栈、java堆、方法区；</p>
<p>程序计数器：线程私有的，是一块很小的内存空间，作为当前线程的行号指示器，用于记录当前虚拟机正在执行的线程指令地址；</p>
<p>虚拟机栈（java栈）：线程私有的，每个方法执行的时候都会创建一个栈帧，用于存储局部变量表、操作数、动态链接和方法返回等信息，当线程请求的栈深度超过了虚拟机允许的最大深度时，就会抛出StackOverFlowError；</p>
<p>本地方法栈：线程私有的，保存的是native方法的信息。</p>
<p>方法区：存放已被加载的类信息、常量、静态变量、即时编译器编译后的代码数据。</p>
<h1 id="15-什么是JVM内存模型？"><a href="#15-什么是JVM内存模型？" class="headerlink" title="15.什么是JVM内存模型？"></a>15.什么是JVM内存模型？</h1><p>Java 内存模型（下文简称 JMM）就是在底层处理器内存模型的基础上，定义自己的多线程语义。它明确指定了一组排序规则，来保证线程间的可见性。</p>
<h1 id="16-heap-和stack-有什么区别？"><a href="#16-heap-和stack-有什么区别？" class="headerlink" title="16.heap 和stack 有什么区别？"></a>16.heap 和stack 有什么区别？</h1><p>1.申请方式：</p>
<p>stack是系统自动分配，heap需要程序员自己申请。（方法中的局部变量使用final修饰后，放在堆中，而不是栈中。）</p>
<p>2.申请效率：</p>
<p>stack：由系统自动分配，速度较快。但程序员是无法控制的。</p>
<p>heap：由 new 分配的内存，一般速度比较慢，而且容易产生内存碎片,不过用起来最方便。</p>
<h1 id="17-什么是类加载？类加载的过程。"><a href="#17-什么是类加载？类加载的过程。" class="headerlink" title="17.什么是类加载？类加载的过程。"></a>17.什么是类加载？类加载的过程。</h1><p>虚拟机把描述类的数据加载到内存里面，并对数据进行<strong>校验、解析和初始化</strong>，最终变成可以被虚拟机<strong>直接使用的class对象</strong>；</p>
<p>类的生命周期：加载、验证、准备、解析、初始化、使用和卸载。</p>
<p>加载，加载分为三步：1、通过类的全限定类名获取该类的二进制流；2、将该二进制流的静态存储结构转为方法区的运行时数据结构；3、在对中为该类生成一个class对象。</p>
<p>验证：验证该class文件中的字节流是否符合虚拟机要求。</p>
<p>准备：为class对象的静态变量分配内存，初始化其初始值；</p>
<p>解析：完成符号引用转化成直接引用。</p>
<p>初始化：执行定义的java代码，调用类构造器的过程。</p>
<h1 id="18-什么是类加载器，常见的类加载器有哪些？"><a href="#18-什么是类加载器，常见的类加载器有哪些？" class="headerlink" title="18.什么是类加载器，常见的类加载器有哪些？"></a>18.什么是类加载器，常见的类加载器有哪些？</h1><p>类加载器：通过一个类的全限定性类名获取该类的二进制字节流叫做类加载器。</p>
<p>启动类加载器（Boot）：用来加载java核心类库、无法被java程序之间引用。</p>
<p>扩展类加载器（Ext）：用来加载java的扩展库，java的虚拟机实现会提供一个扩展库目录，该类加载器在扩展库目录里面查找并加载java类；</p>
<p>系统类加载器（App）：它根据java的类路径来加载类，一般来说，java应用的类都是通过它来加载的；</p>
<p>自定义类加载器：由java语言实现，继承自ClassLoader；</p>
<p><img src="https://mmbiz.qpic.cn/mmbiz_jpg/pG7D3RkPfLCUaasZJJITlkRicCsnKhSU7Mmec7Sc5r6gBydHI0ZoxGynCXpVQdft36D9w961AV75h4VcPd6e4qQ/640?wx_fmt=jpeg&tp=webp&wxfrom=5&wx_lazy=1&wx_co=1"></p>
<h1 id="19-什么是双亲委派模型？为什么需要双亲委派模型？"><a href="#19-什么是双亲委派模型？为什么需要双亲委派模型？" class="headerlink" title="19.什么是双亲委派模型？为什么需要双亲委派模型？"></a>19.什么是双亲委派模型？为什么需要双亲委派模型？</h1><p>双亲委派模型：当一个类加载器收到一个类加载的请求，他首先不会尝试自己去加载，而是将这个请求委派给父类加载器去加载，只有父类加载器在自己的搜索范围类查找不到给类时，子加载器才会尝试自己去加载该类；</p>
<p>作用：防止内存中出现多个相同的字节码，保证类的唯一性。</p>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/dai_modest/about" rel="external nofollow noreferrer">戴某人</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://modest2001.gitee.io/dai_modest/dai_modest/2021/10/11/java-mian-shi-jvm-ba-gu-wen/">https://modest2001.gitee.io/dai_modest/dai_modest/2021/10/11/java-mian-shi-jvm-ba-gu-wen/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/dai_modest/about" target="_blank">戴某人</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/dai_modest/tags/jvm/">
                                    <span class="chip bg-color">jvm</span>
                                </a>
                            
                                <a href="/dai_modest/tags/java/">
                                    <span class="chip bg-color">java</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/dai_modest/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/dai_modest/libs/share/js/social-share.min.js"></script>
    

    
    <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid="></script>
    <div class="addthis_inline_share_toolbox"></div>
    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/dai_modest/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/dai_modest/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/dai_modest/2021/10/20/spring-cloud-rest-huan-jing/">
                    <div class="card-image">
                        
                        
                        <img src="/dai_modest/medias/featureimages/8.jpg" class="responsive-img" alt="spring-cloud-rest环境">
                        
                        <span class="card-title">spring-cloud-rest环境</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            springcloud中的rest环境
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2021-10-20
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/dai_modest/categories/%E5%AD%A6%E4%B9%A0%E7%B1%BB/" class="post-category">
                                    学习类
                                </a>
                            
                            <a href="/dai_modest/categories/%E5%AD%A6%E4%B9%A0%E7%B1%BB/%E7%AC%94%E8%AE%B0%E7%B1%BB/" class="post-category">
                                    笔记类
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/dai_modest/tags/java/">
                        <span class="chip bg-color">java</span>
                    </a>
                    
                    <a href="/dai_modest/tags/springcloud/">
                        <span class="chip bg-color">springcloud</span>
                    </a>
                    
                    <a href="/dai_modest/tags/rest/">
                        <span class="chip bg-color">rest</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/dai_modest/2021/10/10/jvm04/">
                    <div class="card-image">
                        
                        
                        <img src="/dai_modest/medias/featureimages/13.jpg" class="responsive-img" alt="jvm04">
                        
                        <span class="card-title">jvm04</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            jvm中GC算法和分代算法
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2021-10-10
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/dai_modest/categories/%E7%AC%94%E8%AE%B0%E7%B1%BB/" class="post-category">
                                    笔记类
                                </a>
                            
                            <a href="/dai_modest/categories/%E7%AC%94%E8%AE%B0%E7%B1%BB/%E9%9D%A2%E8%AF%95%E7%B1%BB/" class="post-category">
                                    面试类
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/dai_modest/tags/jvm/">
                        <span class="chip bg-color">jvm</span>
                    </a>
                    
                    <a href="/dai_modest/tags/java/">
                        <span class="chip bg-color">java</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>


<script>
    $('#articleContent').on('copy', function (e) {
        // IE8 or earlier browser is 'undefined'
        if (typeof window.getSelection === 'undefined') return;

        var selection = window.getSelection();
        // if the selection is short let's not annoy our users.
        if (('' + selection).length < Number.parseInt('120')) {
            return;
        }

        // create a div outside of the visible area and fill it with the selected text.
        var bodyElement = document.getElementsByTagName('body')[0];
        var newdiv = document.createElement('div');
        newdiv.style.position = 'absolute';
        newdiv.style.left = '-99999px';
        bodyElement.appendChild(newdiv);
        newdiv.appendChild(selection.getRangeAt(0).cloneContents());

        // we need a <pre> tag workaround.
        // otherwise the text inside "pre" loses all the line breaks!
        if (selection.getRangeAt(0).commonAncestorContainer.nodeName === 'PRE' || selection.getRangeAt(0).commonAncestorContainer.nodeName === 'CODE') {
            newdiv.innerHTML = "<pre>" + newdiv.innerHTML + "</pre>";
        }

        var url = document.location.href;
        newdiv.innerHTML += '<br />'
            + '来源: 戴某的博客<br />'
            + '文章作者: 戴某人<br />'
            + '文章链接: <a href="' + url + '">' + url + '</a><br />'
            + '本文章著作权归作者：戴某人所有，任何形式的转载都请注明出处。';

        selection.selectAllChildren(newdiv);
        window.setTimeout(function () {bodyElement.removeChild(newdiv);}, 200);
    });
</script>


<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/dai_modest/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/dai_modest/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/dai_modest/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/dai_modest/libs/codeBlock/codeShrink.js"></script>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/dai_modest/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/dai_modest/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="503838841"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='random'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/dai_modest/libs/aplayer/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

    

    <div class="container row center-align"
         style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2019-2023</span>
            
            <span id="year">2019</span>
            <a href="/dai_modest/about" target="_blank">戴某人</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
                &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                        class="white-color">128.1k</span>
            
            
            
                
            
            
                <span id="busuanzi_container_site_pv">
                &nbsp;|&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;
                    <span id="busuanzi_value_site_pv" class="white-color"></span>
            </span>
            
            
                <span id="busuanzi_container_site_uv">
                &nbsp;|&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;
                    <span id="busuanzi_value_site_uv" class="white-color"></span>
            </span>
            
            <br>

            <!-- 运行天数提醒. -->
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">


    <a href="mailto:861796830@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=861796830" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 861796830" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/dai_modest/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/dai_modest/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/dai_modest/libs/materialize/materialize.min.js"></script>
    <script src="/dai_modest/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/dai_modest/libs/aos/aos.js"></script>
    <script src="/dai_modest/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/dai_modest/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/dai_modest/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/dai_modest/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/dai_modest/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
        <div style="position:fixed;bottom:125px;right:16px;cursor: pointer;">
            <a title="兔小巢" target="_blank" rel="noopener" href="https://support.qq.com/products/"><i class="fa fa-comments fa-3x"  aria-hidden="true"></i></a>
        </div>
    
    
    <script type="text/javascript" color="0,0,255"
        pointColor="0,0,255" opacity='0.7'
        zIndex="-1" count="99"
        src="/dai_modest/libs/background/canvas-nest.js"></script>
    

    
    
    <script type="text/javascript" size="150" alpha='0.6'
        zIndex="-1" src="/dai_modest/libs/background/ribbon.min.js" async="async"></script>
    

    
    <script type="text/javascript" src="/dai_modest/libs/background/ribbon-dynamic.js" async="async"></script>
    

    
    <script src="/dai_modest/libs/instantpage/instantpage.js" type="module"></script>
    

<script src="/dai_modest/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>

</html>
